package com.xd.clap.controller;

import com.xd.clap.entity.Feedback;
import com.xd.clap.entity.response.Result;
import com.xd.clap.services.FeedbackService;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/feedback")
public class FeedbackController {
    @Resource
    private FeedbackService fs;

    /**
     * 查询所有的反馈列表
     */
    @GetMapping("/getFeedbackList")
    public Result getFeedbackList() {
        return fs.getFeedbackList();
    }

    /**
     * 添加反馈
     */
    @GetMapping("/saveFeedback")
    public Result saveFeedback(Feedback feedback) {
        return fs.saveFeedback(feedback);
    }

    /**
     * 删除意见
     */
    @DeleteMapping("/deleteFeedback")
    public Result deleteFeedback(Feedback feedback) {
        return fs.deleteFeedback(feedback.getId());
    }
}
